package net.sudot.chess.business.service;

import net.sudot.chess.business.dao.CustomerRankDao;
import net.sudot.chess.business.model.CustomerRank;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * 客户等级
 *
 * @author tangjialin on 2018-03-03.
 */
@Service
public class CustomerRankService extends BaseService<CustomerRank> {

    @Resource
    private CustomerRankDao customerRankDao;

    /**
     * 查找默认会员等级
     *
     * @return 默认会员等级，若不存在则返回null
     */
    public CustomerRank findDefault() {
        return customerRankDao.findDefault();
    }

    /**
     * 根据押金金额查找符合此条件的最高会员等级
     *
     * @param deposit 押金金额
     * @return 会员等级, 若不存在则返回null
     */
    public CustomerRank findByDeposit(BigDecimal deposit) {
        return customerRankDao.findByDeposit(deposit);
    }
}
